Added password hide and show to install page, Added default table creation function.

This commit is contained in:
xevidos 2019-04-12 09:45:42 -04:00
parent 0904b5328a
commit d298255e51
3 changed files with 115 additions and 9 deletions

View File

@ -140,15 +140,21 @@ if ($newrelic) {
<div style="float:left; width: 48%; margin-right: 4%;">
<label><?php i18n("Password"); ?></label>
<input type="password" name="password" value="<?php echo($autocomplete['password']); ?>">
<label>
<?php i18n("Password"); ?>
<input type="password" name="password" value="<?php echo($autocomplete['password']); ?>">
<span class="icon-eye in-field-icon-right hide_field">
</label>
</div>
<div style="float:left; width: 48%;">
<label><?php i18n("Confirm Password"); ?></label>
<input type="password" name="password_confirm" value="<?php echo($autocomplete['password_confirm']); ?>">
<label>
<?php i18n("Confirm Password"); ?>
<input type="password" name="password_confirm" value="<?php echo($autocomplete['password_confirm']); ?>">
<span class="icon-eye in-field-icon-right hide_field">
</label>
</div>
@ -174,8 +180,11 @@ if ($newrelic) {
<input type="text" name="dbname" value="<?php echo($autocomplete['dbname']); ?>">
<label><?php i18n("Database User"); ?></label>
<input type="text" name="dbuser" value="<?php echo($autocomplete['dbuser']); ?>">
<label><?php i18n("Database Pass"); ?></label>
<input type="text" name="dbpass" value="<?php echo($autocomplete['dbpass']); ?>">
<label>
<?php i18n("Database Pass"); ?>
<input type="password" name="dbpass" value="<?php echo($autocomplete['dbpass']); ?>">
<span class="icon-eye in-field-icon-right hide_field">
</label>
<label><?php i18n("Database Type"); ?></label>
<select name="dbtype">
<?php
@ -334,7 +343,20 @@ if ($newrelic) {
$("[name=timezone] option").each(function() {
if($(this).text().indexOf(timezone) > -1) $("[name=timezone]").val($(this).val());
})
document.querySelectorAll( ".hide_field" ).addEventListener( "click", function( e ) {
let input = e.target.parent.querySelector( 'input' );
if( input.type == "password" ) {
input.type = "text";
} else {
input.type = "password";
}
});
$('#install').on('submit',function(e){
e.preventDefault();

View File

@ -48,6 +48,90 @@ class sql {
//$this->query( $query, array(), array(), null, "rowCount" );
}
public function create_default_tables() {
$this->sql->create_tables(
array(
"active" => array(
"fields" => array(
"username" => "string",
"path" => "text",
"position" => "string",
"focused" => "string"
),
"attributes" => array(
"username" => array( "not null", "unique" ),
"path" => array( "not null", "unique" ),
"focused" => array( "not null" ),
)
),
"options" => array(
"fields" => array(
"id" => "int",
"name" => "string",
"value" => "text",
),
"attributes" => array(
"id" => array( "id" ),
"name" => array( "not null", "unique" ),
"value" => array( "not null" ),
)
),
"projects" => array(
"fields" => array(
"id" => "int",
"name" => "string",
"path" => "text",
"owner" => "string",
"access" => "string",
),
"attributes" => array(
"id" => array( "id" ),
"name" => array( "not null" ),
"path" => array( "not null", "unique" ),
"owner" => array( "not null", "unique" ),
"access" => array(),
)
),
"users" => array(
"fields" => array(
"id" => "int",
"first_name" => "string",
"last_name" => "string",
"username" => "string",
"password" => "text",
"email" => "string",
"project" => "string",
"access" => "string",
"groups" => "string",
"token" => "string",
),
"attributes" => array(
"id" => array( "id" ),
"username" => array( "not null", "unique" ),
"password" => array( "not null" ),
"access" => array( "not null" ),
)
),
"user_options" => array(
"fields" => array(
"id" => "int",
"name" => "string",
"username" => "string",
"value" => "text",
),
"attributes" => array(
"id" => array( "id" ),
"name" => array( "not null", "unique" ),
"username" => array( "not null", "unique" ),
"value" => array( "not null" ),
)
),
)
);
}
public function create_tables( $table ) {
/**

View File

@ -141,7 +141,7 @@ if( defined( "SITE_NAME" ) && ! ( SITE_NAME === "" || SITE_NAME === null ) ) {
<label>
<span class="icon-lock login-icon"></span> <?php i18n("Password"); ?>
<input type="password" name="password">
<span class="icon-eye in-field-icon-right" id="hide_password">
<span class="icon-eye in-field-icon-right hide_field">
</label>
<div class="language-selector">
@ -180,7 +180,7 @@ if( defined( "SITE_NAME" ) && ! ( SITE_NAME === "" || SITE_NAME === null ) ) {
<script src="components/user/init.js"></script>
<script>
$( "#hide_password" ).on( "click", function( e ) {
$( ".hide_field" ).on( "click", function( e ) {
let password = document.querySelector( "input[name='password']" );