-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
731 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
/** | ||
* @overview ccmjs-based web component for a digital makerspace | ||
* @author André Kless <[email protected]> 2018-2022 | ||
* @author André Kless <[email protected]> 2018-2022, 2024 | ||
* @license The MIT License (MIT) | ||
* @version latest (5.0.0) | ||
* @version latest (5.1.0) | ||
* @changes | ||
* version 5.1.0 (17.04.2024): added register form | ||
* version 5.0.0 (03.03.2022): reimplementation | ||
* (for older version changes see ccm.dms-4.5.0.js) | ||
*/ | ||
|
@@ -247,6 +248,37 @@ | |
* @type {Object.<string,Function>} | ||
*/ | ||
this.events = { | ||
onRegister: async () => { | ||
$.params( { view: 'register' }, true, true ); | ||
await this.refresh(); | ||
}, | ||
onRegisterSubmit: async () => { | ||
const store = await this.ccm.store( { url: 'https://ccm2.inf.h-brs.de', name: 'dms-user' } ); | ||
const { name, username, password } = $.formData( element.querySelector( '#register_form' ) ); | ||
try { | ||
await store.set( { | ||
key: username, | ||
user: username, | ||
name, | ||
realm: 'cloud', | ||
token: this.user.hash.md5( password ), | ||
_: { | ||
creator: username, | ||
realm: 'cloud', | ||
access: { | ||
get: 'creator', | ||
set: 'creator', | ||
del: 'creator' | ||
} | ||
}, | ||
} ); | ||
alert(this.lang.translate('register_success')); | ||
$.params( { view: 'home' }, true, true ); | ||
await this.refresh(); | ||
} catch (e) { | ||
alert(this.lang.translate('register_failed')); | ||
} | ||
}, | ||
onLogin: async () => { | ||
await this.user.login(); | ||
await this.start(); | ||
|
@@ -449,6 +481,8 @@ | |
case 'app': | ||
case 'component': | ||
return this.render.item( params.view, params.id ); | ||
case 'register': | ||
return this.render.register(); | ||
} | ||
if ( params.edit ) return this.render.edit( params.edit, params.id ); | ||
if ( params.editor ) return this.render.editor( params.editor, params.template ); | ||
|
@@ -578,6 +612,11 @@ | |
tool: tool_meta.path, | ||
url: ( component, config ) => this.url + '?app=' + config[ 2 ].toString() | ||
} ); | ||
}, | ||
register: async () => { | ||
this.render.header(); | ||
this.html.render( this.html.register(), element ); | ||
this.lang && this.lang.translate(); | ||
} | ||
}; | ||
|
||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<meta name="author" content="André Kless <[email protected]> 2022"> | ||
<meta name="author" content="André Kless <[email protected]> 2022, 2024"> | ||
<meta name="license" content="The MIT License (MIT)"> | ||
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico"> | ||
<title>Digital Makerspace</title> | ||
<style>body { margin: 0; background-color: rgb( 248, 249, 250 ) }</style> | ||
<script src="https://ccmjs.github.io/digital-makerspace/versions/ccm.dms-5.0.0.min.js"></script> | ||
<ccm-dms-5-0-0 src='["ccm.load","https://ccmjs.github.io/digital-makerspace/resources/resources.mjs#live"]'></ccm-dms-5-0-0> | ||
<script src="https://ccmjs.github.io/digital-makerspace/versions/ccm.dms-5.1.0.js"></script> | ||
<ccm-dms-5-1-0 src='["ccm.load","https://ccmjs.github.io/digital-makerspace/resources/resources.mjs#live"]'></ccm-dms-5-1-0> |
Oops, something went wrong.