first&last name
This commit is contained in:
@@ -38,9 +38,10 @@ async def login(
|
||||
|
||||
@r.post("/signup")
|
||||
async def signup(
|
||||
firstname:str, lastname:str,
|
||||
db=Depends(get_db), form_data: OAuth2PasswordRequestForm = Depends()
|
||||
):
|
||||
user = sign_up_new_user(db, form_data.username, form_data.password)
|
||||
user = sign_up_new_user(db, form_data.username, form_data.password,firstname,lastname)
|
||||
if not user:
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_409_CONFLICT,
|
||||
|
||||
@@ -241,7 +241,6 @@ async def get_useractivedomain(
|
||||
)
|
||||
async def update_activeuserdomain(
|
||||
request: Request,
|
||||
userid: int,
|
||||
domainid:int,
|
||||
user=Depends(get_current_user),
|
||||
db=Depends(get_db),
|
||||
|
||||
@@ -58,7 +58,7 @@ def authenticate_user(db, email: str, password: str):
|
||||
return user
|
||||
|
||||
|
||||
def sign_up_new_user(db, email: str, password: str):
|
||||
def sign_up_new_user(db, email: str, password: str, firstname: str,lastname: str):
|
||||
user = get_user_by_email(db, email)
|
||||
if user:
|
||||
return False # User already exists
|
||||
@@ -67,6 +67,8 @@ def sign_up_new_user(db, email: str, password: str):
|
||||
schemas.UserCreate(
|
||||
email=email,
|
||||
password=password,
|
||||
firstname = firstname,
|
||||
lastname = lastname,
|
||||
is_active=True,
|
||||
is_superuser=False,
|
||||
),
|
||||
|
||||
@@ -21,6 +21,8 @@ class UserOut(UserBase):
|
||||
|
||||
class UserCreate(UserBase):
|
||||
password: str
|
||||
first_name: str
|
||||
last_name: str
|
||||
|
||||
class Config:
|
||||
orm_mode = True
|
||||
|
||||
@@ -22,7 +22,6 @@ export const useAuthStore = defineStore({
|
||||
this.token =result.data.access_token;
|
||||
this.name = result.data.user_name;
|
||||
localStorage.setItem('token', result.data.access_token);
|
||||
localStorage.setItem('id', result.data.user_id);
|
||||
localStorage.setItem('name', result.data.user_name);
|
||||
const config = {headers:{Authorization : 'Bearer ' + this.token}};
|
||||
const activedomain = await api.get(`http://127.0.0.1:8000/api/activedomain`,config);
|
||||
|
||||
Reference in New Issue
Block a user