Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
scratch-www
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
scratch-www
Commits
bf28fae9
Commit
bf28fae9
authored
Jul 21, 2016
by
Matthew Taylor
Committed by
GitHub
Jul 21, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #739 from mewtaylor/issue/gh-698
Fix GH-698: refresh session on successful registration
parents
63b0b03b
859877c1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
3 deletions
+20
-3
src/views/teacherregistration/teacherregistration.jsx
src/views/teacherregistration/teacherregistration.jsx
+20
-3
No files found.
src/views/teacherregistration/teacherregistration.jsx
View file @
bf28fae9
var
connect
=
require
(
'
react-redux
'
).
connect
;
var
defaults
=
require
(
'
lodash.defaultsdeep
'
);
var
React
=
require
(
'
react
'
);
var
render
=
require
(
'
../../lib/render.jsx
'
);
var
api
=
require
(
'
../../lib/api
'
);
var
sessionActions
=
require
(
'
../../redux/session.js
'
);
var
Deck
=
require
(
'
../../components/deck/deck.jsx
'
);
var
Progression
=
require
(
'
../../components/progression/progression.jsx
'
);
...
...
@@ -67,12 +69,16 @@ var TeacherRegistration = React.createClass({
},
function
(
err
,
res
)
{
this
.
setState
({
waiting
:
false
});
if
(
err
)
return
this
.
setState
({
registrationError
:
err
});
if
(
res
[
0
].
success
)
return
this
.
advanceStep
(
formData
);
if
(
res
[
0
].
success
)
{
this
.
props
.
dispatch
(
sessionActions
.
refreshSession
());
return
this
.
advanceStep
(
formData
);
}
this
.
setState
({
registrationError
:
res
[
0
].
msg
});
}.
bind
(
this
));
},
render
:
function
()
{
var
permissions
=
this
.
props
.
session
.
permissions
||
{};
return
(
<
Deck
className=
"teacher-registration"
>
{
this
.
state
.
registrationError
?
...
...
@@ -101,7 +107,10 @@ var TeacherRegistration = React.createClass({
waiting=
{
this
.
state
.
waiting
}
/>
<
Steps
.
EmailStep
onNextStep=
{
this
.
register
}
waiting=
{
this
.
state
.
waiting
}
/>
<
Steps
.
TeacherApprovalStep
email=
{
this
.
state
.
formData
.
user
&&
this
.
state
.
formData
.
user
.
email
}
/>
<
Steps
.
TeacherApprovalStep
email=
{
this
.
state
.
formData
.
user
&&
this
.
state
.
formData
.
user
.
email
}
confirmed=
{
permissions
.
social
}
invited=
{
permissions
.
educator_invitee
}
educator=
{
permissions
.
educator
}
/>
</
Progression
>
}
</
Deck
>
...
...
@@ -109,4 +118,12 @@ var TeacherRegistration = React.createClass({
}
});
render
(<
TeacherRegistration
/>,
document
.
getElementById
(
'
app
'
));
var
mapStateToProps
=
function
(
state
)
{
return
{
session
:
state
.
session
.
session
};
};
var
ConnectedTeacherRegistration
=
connect
(
mapStateToProps
)(
TeacherRegistration
);
render
(<
ConnectedTeacherRegistration
/>,
document
.
getElementById
(
'
app
'
));
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment