Skip to content

Commit

Permalink
Merge branch 'master' into update-login-page
Browse files Browse the repository at this point in the history
  • Loading branch information
jsaq007 committed Mar 11, 2024
2 parents 767d120 + f07d118 commit 4e7a6e5
Show file tree
Hide file tree
Showing 9 changed files with 90 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,13 @@ class Config:
"email": "maxwel@email.com",
"phone": "+1 123456789",
"company": "EM Com",
"address": "Infinite Loop. California",
"address": "Infinite Loop",
"city": "Washington",
"postalCode": "98001",
"country": "USA",
"application": "Antenna_Design",
"description": "Description of something",
"hear": "Search_Engine",
"message": "I would love to use your tool",
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
"""phone not-unique
Revision ID: 30e8b752e33e
Revises: c1d0e98cd289
Create Date: 2024-03-11 12:21:35.856004+00:00
"""
from alembic import op

# revision identifiers, used by Alembic.
revision = "30e8b752e33e"
down_revision = "c1d0e98cd289"
branch_labels = None
depends_on = None


def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_constraint("user_phone_unique_constraint", "users", type_="unique")
# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_unique_constraint("user_phone_unique_constraint", "users", ["phone"])
# ### end Alembic commands ###
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ class UserStatus(Enum):
"phone",
sa.String(),
nullable=True, # since 2FA can be configured optional
doc="Confirmed user phone used e.g. to send a code for a two-factor-authentication",
doc="Confirmed user phone used e.g. to send a code for a two-factor-authentication."
"NOTE: new policy (NK) is that the same phone can be reused therefore it does not has to be unique",
),
sa.Column(
"password_hash",
Expand Down Expand Up @@ -160,11 +161,6 @@ class UserStatus(Enum):
sa.PrimaryKeyConstraint("id", name="user_pkey"),
sa.UniqueConstraint("name", name="user_name_ukey"),
sa.UniqueConstraint("email", name="user_login_key"),
sa.UniqueConstraint(
"phone",
name="user_phone_unique_constraint",
# NOTE: that cannot use same phone for two user accounts
),
)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@
sa.Column(
"pre_phone",
sa.String(),
doc="Phone provided on pre-registration (copied to users.phone upon registration)",
doc="Phone provided on pre-registration"
"NOTE: this is not copied upon registration since it needs to be confirmed",
),
# Billable address columns:
sa.Column("company_name", sa.String()),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,18 @@ async def join_and_update_from_pre_registration_details(
pre_columns = (
users_pre_registration_details.c.pre_first_name,
users_pre_registration_details.c.pre_last_name,
users_pre_registration_details.c.pre_phone,
# NOTE: pre_phone is not copied since it has to be validated. Otherwise, if
# phone is wrong, currently user won't be able to login!
)

assert {c.name for c in pre_columns} == { # nosec
c.name
for c in users_pre_registration_details.columns
if c != users_pre_registration_details.c.pre_email
if c
not in (
users_pre_registration_details.c.pre_email,
users_pre_registration_details.c.pre_phone,
)
and c.name.startswith("pre_")
}, "Different pre-cols detected. This code might need an update update"

Expand All @@ -122,7 +127,6 @@ async def join_and_update_from_pre_registration_details(
.values(
first_name=details.pre_first_name,
last_name=details.pre_last_name,
phone=details.pre_phone,
)
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ qx.Class.define("osparc.auth.LoginPage", {
break;
}
case "top-spacer":
control = new qx.ui.core.Spacer();
control = new qx.ui.core.Spacer().set({
minHeight: 50
});
this.getChildControl("main-layout").add(control, {
flex: 1
});
Expand All @@ -77,7 +79,9 @@ qx.Class.define("osparc.auth.LoginPage", {
});
break;
case "bottom-spacer":
control = new qx.ui.core.Spacer();
control = new qx.ui.core.Spacer().set({
minHeight: 50
});
this.getChildControl("main-layout").add(control, {
flex: 1
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ qx.Class.define("osparc.auth.core.BaseAuthPage", {
},

statics: {
FORM_WIDTH: 300
FORM_WIDTH: 310
},

/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,46 +75,69 @@ qx.Class.define("osparc.auth.ui.RequestAccount", {
const address = new qx.ui.form.TextField().set({
required: true
});
doubleSpaced.push(address);
this._form.add(address, this.tr("Address"), null, "address");

const city = new qx.ui.form.TextField().set({
required: true
});
this._form.add(city, this.tr("City"), null, "city");

const postalCode = new qx.ui.form.TextField().set({
required: true
});
this._form.add(postalCode, this.tr("Postal code"), null, "postalCode");

const country = new qx.ui.form.TextField().set({
required: true
});
doubleSpaced.push(country);
this._form.add(country, this.tr("Country"), null, "country");

const application = new qx.ui.form.SelectBox();
[{
id: "Antenna_Design",
label: "Antenna Design"
id: "Antenna_Design_for_Wireless_Communication",
label: "Antenna Design for Wireless Communication"
}, {
id: "MRI_System_Design_and_Optimization",
label: "MRI System Design and Optimization"
id: "Bioelectronics,_Electroceuticals_and_Neuroprosthetics",
label: "Bioelectronics, Electroceuticals & Neuroprosthetics"
}, {
id: "MRI_Implant_Safety",
label: "MRI Implant Safety"
id: "Safety_and_Efficacy_Assessment",
label: "Safety & Efficacy Assessment"
}, {
id: "MRI_Safety",
label: "MRI Safety"
id: "Exposure_and_Compliance",
label: "Exposure & Compliance"
}, {
id: "Focused_Ultrasound",
label: "Focused Ultrasound"
}, {
id: "EM-induced_Neuronal_Dynamics",
label: "EM-induced Neuronal Dynamics"
id: "In_Silico_Trials",
label: "In <i>Silico</i> Trials"
}, {
id: "Implant_Design",
label: "Implant Design"
}, {
id: "Magnetic_Resonance_Imaging",
label: "Magnetic Resonance Imaging"
}, {
id: "Neurostimulation",
label: "Neurostimulation"
}, {
id: "Personalized_Medicine",
label: "Personalized Medicine"
}, {
id: "Thermal_Therapies",
label: "Thermal Therapies"
}, {
id: "Wireless_Body_Area_Networks",
label: "Wireless Body Area Networks"
}, {
id: "Wireless_Power_Transfer",
label: "Wireless Power Transfer"
id: "Wireless_Power_Transfer_Systems",
label: "Wireless Power Transfer Systems"
}, {
id: "Other",
label: "Other (please specify below)"
id: "Vascular_Flow_and_Perfusion",
label: "Vascular Flow & Perfusion"
}].forEach(appData => {
const lItem = new qx.ui.form.ListItem(appData.label, null, appData.id);
const lItem = new qx.ui.form.ListItem(appData.label, null, appData.id).set({
rich: true
});
application.add(lItem);
});
doubleSpaced.push(application);
Expand Down Expand Up @@ -147,10 +170,6 @@ qx.Class.define("osparc.auth.ui.RequestAccount", {
doubleSpaced.push(hear);
this._form.add(hear, this.tr("How did you hear about us?"), null, "hear");

const message = new qx.ui.form.TextField();
doubleSpaced.push(message);
this._form.add(message, this.tr("Message"), null, "message");

// eula links
const color = qx.theme.manager.Color.getInstance().resolve("text");
const ppText = `I acknowledge that data will be processed in accordance with <a href='https://sim4life.swiss/privacy' style='color: ${color}' target='_blank''>our privacy policy</a>`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ qx.Class.define("osparc.ui.form.renderer.DoubleV", {

const itemLayout = new qx.ui.container.Composite(new qx.ui.layout.VBox());
const label = this._createLabel(name, item).set({
font: "text-12"
font: "text-12",
allowGrowX: true
});
label.setBuddy(item);
itemLayout.add(label);
Expand Down

0 comments on commit 4e7a6e5

Please sign in to comment.