diff --git a/src/components/auth/Permissions.jsx b/src/components/auth/Permissions.jsx
index 7cc8f11..c057bfa 100644
--- a/src/components/auth/Permissions.jsx
+++ b/src/components/auth/Permissions.jsx
@@ -18,14 +18,13 @@ class Body extends BaseAuthBody {
oAuthComplete: PropTypes.func.isRequired,
auth: PropTypes.shape({
error: PropTypes.string,
- login: PropTypes.shape({
- login: PropTypes.stirng
- })
+ scopes: PropTypes.array.isRequired
})
};
render() {
const {user} = this.props;
+ const scopes = this.props.auth.scopes;
return (
@@ -53,10 +52,9 @@ class Body extends BaseAuthBody {
- - Authorization for Minecraft servers
- - Manage your skins directory and additional rows for multiline
- - Change the active skin
- - View your E-mail address
+ {scopes.map((scope) => (
+ - {}
+ ))}
@@ -83,8 +81,14 @@ export default function Permissions() {
),
- Links: () => (
-
+ Links: (props) => (
+ {
+ event.preventDefault();
+
+ props.onAuthComplete({
+ accept: false
+ });
+ }}>
)
diff --git a/src/components/auth/Permissions.messages.js b/src/components/auth/Permissions.messages.js
index b1d4c56..bde9236 100644
--- a/src/components/auth/Permissions.messages.js
+++ b/src/components/auth/Permissions.messages.js
@@ -29,5 +29,15 @@ export default defineMessages({
approve: {
id: 'approve',
defaultMessage: 'Approve'
+ },
+
+ scope_minecraft_server_session: {
+ id: 'scope_minecraft_server_session',
+ defaultMessage: 'Authorization data for minecraft server'
+ },
+
+ scope_offline_access: {
+ id: 'scope_offline_access',
+ defaultMessage: 'Access to your profile data, when you offline'
}
});
diff --git a/src/components/auth/actions.js b/src/components/auth/actions.js
index f86f253..1e9a031 100644
--- a/src/components/auth/actions.js
+++ b/src/components/auth/actions.js
@@ -155,6 +155,7 @@ export function oAuthValidate(oauth) {
.then((resp) => {
dispatch(setClient(resp.client));
dispatch(setOAuthRequest(resp.oAuth));
+ dispatch(setScopes(resp.session.scopes));
})
.catch((resp = {}) => { // TODO
handleOauthParamsValidation(resp);
@@ -246,3 +247,15 @@ export function setOAuthRequest(oauth) {
}
};
}
+
+export const SET_SCOPES = 'set_scopes';
+export function setScopes(scopes) {
+ if (!(scopes instanceof Array)) {
+ throw new Error('Scopes must be array');
+ }
+
+ return {
+ type: SET_SCOPES,
+ payload: scopes
+ };
+}
diff --git a/src/components/auth/reducer.js b/src/components/auth/reducer.js
index 55a6a42..402b3a3 100644
--- a/src/components/auth/reducer.js
+++ b/src/components/auth/reducer.js
@@ -1,11 +1,12 @@
import { combineReducers } from 'redux';
-import { ERROR, SET_CLIENT, SET_OAUTH } from './actions';
+import { ERROR, SET_CLIENT, SET_OAUTH, SET_SCOPES } from './actions';
export default combineReducers({
error,
client,
- oauth
+ oauth,
+ scopes
});
function error(
@@ -59,3 +60,16 @@ function oauth(
return state;
}
}
+
+function scopes(
+ state = [],
+ {type, payload = []}
+) {
+ switch (type) {
+ case SET_SCOPES:
+ return payload;
+
+ default:
+ return state;
+ }
+}