Skip to content

[bugfix] Fix for is1499 #1516

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
May 26, 2020
Merged
7 changes: 6 additions & 1 deletion services/web/client/source/class/osparc/auth/LoginPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,12 @@ qx.Class.define("osparc.auth.LoginPage", {
login.resetValues();
}, this);

[register, resetRequest, reset].forEach(srcPage => {
register.addListener("done", msg => {
osparc.utils.Utils.cookie.deleteCookie("user");
this.fireDataEvent("done", msg);
});

[resetRequest, reset].forEach(srcPage => {
srcPage.addListener("done", msg => {
pages.setSelection([login]);
srcPage.resetValues();
Expand Down
11 changes: 2 additions & 9 deletions services/web/client/source/class/osparc/auth/Manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,20 +108,14 @@ qx.Class.define("osparc.auth.Manager", {
.finally(this.__logoutUser());
},

register: function(userData, successCbk, failCbk, context) {
console.debug("Registering user ...");
register: function(userData) {
const params = {
data: userData
};
osparc.data.Resources.fetch("auth", "postRegister", params)
.then(data => {
successCbk.call(context, data);
})
.catch(err => failCbk.call(context, err.message));
return osparc.data.Resources.fetch("auth", "postRegister", params);
},

resetPasswordRequest: function(email, successCbk, failCbk, context) {
console.debug("Requesting reset password ...");
const params = {
data: {
email
Expand All @@ -135,7 +129,6 @@ qx.Class.define("osparc.auth.Manager", {
},

resetPassword: function(newPassword, confirmation, code, successCbk, failCbk, context) {
console.debug("Reseting password ...");
const params = {
url: {
code
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,6 @@ qx.Class.define("osparc.auth.ui.RegistrationView", {
email.activate();
});

// const uname = new qx.ui.form.TextField().set({
// required: true,
// placeholder: this.tr("Introduce a user name")
// });
// this.add(uname);

const pass1 = new qx.ui.form.PasswordField().set({
required: true,
placeholder: this.tr("Introduce a password")
Expand Down Expand Up @@ -88,7 +82,6 @@ qx.Class.define("osparc.auth.ui.RegistrationView", {
return osparc.auth.core.Utils.checkSamePasswords(pass1, pass2);
});


// submit & cancel buttons
const grp = new qx.ui.container.Composite(new qx.ui.layout.HBox(10));

Expand Down Expand Up @@ -123,21 +116,15 @@ qx.Class.define("osparc.auth.ui.RegistrationView", {
},

__submit: function(userData) {
console.debug("Registering new user");

let manager = osparc.auth.Manager.getInstance();

let successFun = function(log) {
this.fireDataEvent("done", log.message);
osparc.component.message.FlashMessenger.getInstance().log(log);
};

let failFun = function(msg) {
msg = msg || this.tr("Cannot register user");
osparc.component.message.FlashMessenger.getInstance().logAs(msg, "ERROR");
};

manager.register(userData, successFun, failFun, this);
osparc.auth.Manager.getInstance().register(userData)
.then(log => {
this.fireDataEvent("done", log.message);
osparc.component.message.FlashMessenger.getInstance().log(log);
})
.catch(err => {
const msg = err.message || this.tr("Cannot register user");
osparc.component.message.FlashMessenger.getInstance().logAs(msg, "ERROR");
});
},

_onAppear: function() {
Expand Down