-
Notifications
You must be signed in to change notification settings - Fork 0
feat: add ex-register-box component and Account API endpoint #66
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
Changes from all commits
18896eb
cd09667
f49e261
3c5ad1d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| using Microsoft.AspNetCore.Authorization; | ||
| using Microsoft.AspNetCore.Mvc; | ||
|
|
||
| namespace Api.Controllers; | ||
|
|
||
| public record CreateAccountRequest(string Email, string Password); | ||
|
|
||
| public record CreateAccountResponse(int Id, string Email); | ||
|
|
||
|
|
||
| [ApiController] | ||
| [Route("api/[controller]")] | ||
| public class AccountController : ControllerBase | ||
| { | ||
| [HttpPost] | ||
| public ActionResult<CreateAccountResponse> Register(CreateAccountRequest request) | ||
| { | ||
| return this.Ok(new CreateAccountResponse(1, request.Email)); | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,6 +10,15 @@ | |
| builder.WebHost.UseUrls($"http://0.0.0.0:{port}"); | ||
|
|
||
| builder.Services.AddControllers(); | ||
|
|
||
| if (builder.Environment.IsDevelopment()) | ||
| { | ||
| builder.Services.AddCors(options => | ||
| { | ||
| options.AddDefaultPolicy(policy => | ||
| policy.AllowAnyOrigin().AllowAnyMethod().AllowAnyHeader()); | ||
| }); | ||
|
Comment on lines
+16
to
+20
|
||
| } | ||
| builder.Services.AddEndpointsApiExplorer(); | ||
| builder.Services.AddSwaggerGen(options => | ||
| { | ||
|
|
@@ -61,6 +70,11 @@ [new OpenApiSecuritySchemeReference("Bearer", doc)] = [], | |
| c.RoutePrefix = "api/docs"; | ||
| }); | ||
|
|
||
| if (app.Environment.IsDevelopment()) | ||
| { | ||
| app.UseCors(); | ||
| } | ||
|
|
||
| app.MapControllers(); | ||
|
|
||
| Console.WriteLine($"Starting ExpressThat Auth API on port {port}..., http://localhost:{port}/api/docs"); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,25 +1,21 @@ | ||
| "use client"; | ||
|
|
||
| import { Button } from "@expressthat-auth/internal-components/button"; | ||
| import { ExLoginBox, ExTestButton } from "@expressthat-auth/ui-react"; | ||
| import { ExLoginBox, ExRegisterBox, ExTestButton } from "@expressthat-auth/ui-react/next"; | ||
|
|
||
| export default function Home() { | ||
| return ( | ||
| <main className="flex min-h-screen flex-col items-center justify-center gap-6 p-8"> | ||
| <h1 className="text-4xl font-bold text-gray-900">ExpressThat Auth</h1> | ||
| <p className="text-lg text-gray-600">Welcome to the authentication portal.</p> | ||
| <Button>Get Started</Button> | ||
| <ExTestButton | ||
| label="Click Me" | ||
| variant="outline" | ||
| onExTestClick={() => { | ||
| alert("test"); | ||
| }} | ||
| /> | ||
| <ExTestButton label="Click Me" variant="outline" /> | ||
|
|
||
| <ExLoginBox> | ||
| <p slot="social-logins">test</p> | ||
| </ExLoginBox> | ||
|
|
||
| <ExRegisterBox> | ||
| <p slot="social-logins">test</p> | ||
| </ExRegisterBox> | ||
| </main> | ||
| ); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,6 +4,7 @@ | |
| "private": true, | ||
| "description": "StencilJS web component library for ExpressThat Auth", | ||
| "type": "module", | ||
| "main": "dist/index.cjs.js", | ||
| "module": "dist/components/index.js", | ||
| "collection": "dist/collection/collection-manifest.json", | ||
|
Comment on lines
6
to
9
|
||
| "types": "dist/types/index.d.ts", | ||
|
|
@@ -50,11 +51,13 @@ | |
| "check-types": "tsc --noEmit" | ||
| }, | ||
| "devDependencies": { | ||
| "@expressthat-auth/api-client": "workspace:*", | ||
| "@expressthat-auth/typescript-config": "workspace:*", | ||
| "@stencil/angular-output-target": "^0.10.0", | ||
| "@stencil/core": "^4.30.0", | ||
| "@stencil/react-output-target": "^1.2.0", | ||
| "@stencil/vue-output-target": "^0.13.1", | ||
| "esbuild": "^0.28.0", | ||
| "typescript": "6.0.3" | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| :host { | ||
| display: block; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
using Microsoft.AspNetCore.Authorization;is unused in this controller (there’s no[Authorize]/[AllowAnonymous]usage). Please remove the unused using to keep the file clean, or add the intended attribute if authorization behavior was meant to be explicit.